b0489c1d704afff5b54ed8d8fdf96346abfbf2bf,services/core/java/com/android/server/content/ContentService.java,ContentService,notifyChange,#Uri#IContentObserver#boolean#number#number#,345
Before Change
final int pid = Binder.getCallingPid();
final int callingUserHandle = UserHandle.getCallingUserId();
userHandle = handleIncomingUser(uri, pid, uid,
Intent.FLAG_GRANT_WRITE_URI_PERMISSION, userHandle);
final String msg = LocalServices.getService(ActivityManagerInternal.class)
.checkContentProviderAccess(uri.getAuthority(), userHandle);
if (msg != null) {
Log.w(TAG, "Ignoring notify for " + uri + " from " + uid + ": " + msg);
return;
}
// This makes it so that future permission checks will be in the context of this
// process rather than the caller's process. We will restore this before returning.
After Change
final int pid = Binder.getCallingPid();
final int callingUserHandle = UserHandle.getCallingUserId();
// Notify for any user other than the caller requires uri grant or cross user permission
if (callingUserHandle != userHandle) {
if (checkUriPermission(uri, pid, uid, Intent.FLAG_GRANT_WRITE_URI_PERMISSION,
userHandle) != PackageManager.PERMISSION_GRANTED) {
enforceCrossUserPermission(userHandle, "no permission to notify other users");
}
}
// We passed the permission check; resolve pseudouser targets as appropriate
if (userHandle < 0) {
if (userHandle == UserHandle.USER_CURRENT) {
userHandle = ActivityManager.getCurrentUser();
} else if (userHandle != UserHandle.USER_ALL) {
throw new InvalidParameterException("Bad user handle for notifyChange: "
+ userHandle);
}
}